//
//  SearchTableViewCell.m
//  ebook
//
//  Created by 吴超飞 on 2016/12/20.
//  Copyright © 2016年 Moton. All rights reserved.
//

#import "SearchTableViewCell.h"

@implementation SearchTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

//使用懒加载创建分割线view,保证一个cell只有一条
-(UIView *)separatorView
{
    if (_separatorView == nil) {
        UIView *separatorView = [[UIView alloc]init];
        _separatorView = separatorView;
        separatorView.backgroundColor = [UIColor groupTableViewBackgroundColor];
        [self addSubview:separatorView];
    }
    return _separatorView;
}

-(void)layoutSubviews{

    [super layoutSubviews];
    self.separatorView.frame = CGRectMake(20, self.bounds.size.height-1,     self.bounds.size.width, 1);
    
    self.textLabel.frame = CGRectMake(50, 10, MTScreenW-150, 24);
    self.imageView.frame = CGRectMake(10, 11, 22, 22);
    self.imageView.image = [UIImage imageNamed:@"search"];
    self.detailTextLabel.frame = CGRectMake(10, MTScreenW-100, 80, 24);
    self.detailTextLabel.textAlignment = NSTextAlignmentRight;
}

@end
